import request from '@/utils/request'

export const reqSpuList = (page,limit,category3Id) => { 
    return request.get(`/admin/product/${page}/${limit}`, {
        params: {
            category3Id
        }
    });
}

//获取某一个SPU基本信息【类的名字、类的描述、类已有销售属性】
export const reqSpuInfo = (spuId)=>request({url:`/admin/product/getSpuById/${spuId}`,method:'get'});

//获取某一个SPU照片墙的数据
export const reqSpuImgList = (spuId)=>request({url:`/admin/product/spuImageList/${spuId}`,method:'get'});

//获取品牌的数据
export const reqTradeMark = ()=>request({url:`/admin/product/baseTrademark/getTrademarkList`,method:'get'});

//获取全部SPU的：全部销售属性,颜色、版本、尺码
export const reqAllSaleAttr=()=>request({url:`/admin/product/baseSaleAttrList`,method:'get'});


//新增SPU|修改SPU接口
export const reqAddOrUpdateSpu = (data) => {
    //修改
    if (data.id) {
        return request({ url: `/admin/product/updateSpuInfo`, method: 'post', data });
    } else {
        //新增  
        return request({ url: `/admin/product/saveSpuInfo`, method: 'post', data });
    }
}


//平台属性接口
export const reqAttrList = (category1Id,category2Id,category3Id)=>request({url:`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,method:'get'});


//销售属性接口

export const reqSaleAttrList = (spuId)=>request({url:`/admin/product/spuSaleAttrList/${spuId}`,method:"get"});


//添加SKU的接口
export const reqAddSku = (data)=>request({url:`/admin/product/saveSkuInfo`,method:'post',data});

//查看类的全部实例
export const reqSkuInfo = (spuId)=>request({url:`/admin/product/findBySpuId/${spuId}`,method:'get'});


//删除某一个类
export const reqDeleteSpu = (spuId)=>request({url:`/admin/product/deleteSpu/${spuId}`,method:'delete'});